import request from '@/config/request'

export function userlist(query) {
  return request({
    url: '/basic/user-info/list',
    method: 'get',
    params: query
  })
}


export function getUser(id) {
  return request({
    url: '/basic/user-info/'+id,
    method: 'get',
  })
}

export function getUserAll() {
  return request({
    url: '/basic/user-info/getUser',
    method: 'get',
  })
}

// 新增菜单
export function addUser(data) {
  return request({
    url: '/basic/user-info',
    method: 'post',
    data: data
  })
}
// 修改自己的密码
export function updatePwdOld(data) {
  return request({
    url: '/basic/user-info/updatePwdOld',
    method: 'post',
    params: data
  })
}
// 重置密码
export function resetPassword(userName) {
  return request({
    url: '/basic/user-info/resetPassword?userName='+userName,
    method: 'post',
  })
}
// 修改菜单
export function updateUser(data) {
  return request({
    url: '/basic/user-info',
    method: 'put',
    data: data
  })
}
// 用户修改自身信息
export function updateThis(data) {
  return request({
    url: '/basic/user-info/updateThis',
    method: 'put',
    data: data
  })
}

// 删除用户
export function delUser(userId) {
  return request({
    url: '/basic/user-info/' + userId,
    method: 'delete'
  })
}


export function sessionStop() {
  return request({
    url: '/basic/user-info/sessionStop',
    method: 'get',
  })
}
